<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2283：[Sdoi2011]火星移民</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Sdoi2011]火星移民</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Sdoi2011]火星移民</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Sdoi2011]火星移民                </h1>
                <p>时间限制：40s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：512MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><h1 align="center" style="margin: 17pt 0cm 16.5pt; text-align: center"><span style="font-size: medium"><span style="font-family: 宋体">在</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">2xyz</span><span style="font-family: 宋体">年，人类已经移民到了火星上。由于工业的需要，人们开始在火星上采矿。火星的矿区是一个边长为</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">N</span><span style="font-family: 宋体">的正六边形，为了方便规划，整个矿区被分为</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">6*N*N</span><span style="font-family: 宋体">个正三角形的区域（如图</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="font-family: 宋体">）。</span></span></h1>
<p><img height="303" alt="" width="574" src="../file/2283_0.jpg" /></p>
<h1 align="center" style="margin: 17pt 0cm 16.5pt; text-align: center"><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></h1>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p></p>
<p></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p></p>
<p></p>
<p class="NOI" style="margin: 13pt 0cm"></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;"><v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style="width: 407.25pt; height: 228.75pt"><v:imagedata o:title="" src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\01\clip_image001.png"></v:imagedata></v:shape><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">整个矿区中存在</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">A</span><span style="font-family: 宋体">矿，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">B</span><span style="font-family: 宋体">矿，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">C</span><span style="font-family: 宋体">矿三个矿场，和</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">a</span><span style="font-family: 宋体">厂，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">b</span><span style="font-family: 宋体">厂，</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">c</span><span style="font-family: 宋体">厂三个炼矿厂。每个三角形的区域可以是一个矿场、炼矿厂、山地、或者平地。现在矿区管理局要求建立一个交通系统，使得矿场和对应炼矿厂之间存在一条公路，并且三条公路互不交叉</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">(</span><span style="font-family: 宋体">即一个三角形区域中不存在两条以上运输不同矿的公路</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">)</span><span style="font-family: 宋体">。两个三角形区域是相邻的当且仅当这两个三角形存在公共边，只有相邻的两个区域之间才能建一段路，建这段路的费用为</span><span lang="EN-US" style="font-family: &quot;Times New Roman&quot;">1</span><span style="font-family: 宋体">。注意，山地上是不能建公路的。由于火星金融危机的影响，矿区管理局想知道建立这样一个交通系统最少要花多少费用。更多的，当局向知道有多少种花费最小的方案。</span></span></p></p><hr/><h3>输入格式</h3><p><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">第</span><span lang="EN-US" style="font-family: 'Times New Roman'">1</span><span style="font-family: 宋体">行一个整数</span><span lang="EN-US" style="font-family: 'Times New Roman'">N</span><span style="font-family: 宋体">。表示这个矿区是边长为</span><span lang="EN-US" style="font-family: 'Times New Roman'">N</span><span style="font-family: 宋体">的正六边形。</span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">接下来有</span><span lang="EN-US" style="font-family: 'Times New Roman'">6*N*N</span><span style="font-family: 宋体">的整数，分为</span><span lang="EN-US" style="font-family: 'Times New Roman'">2*N</span><span style="font-family: 宋体">行，表示矿区当前区域的情况。</span><span lang="EN-US" style="font-family: 'Times New Roman'">0</span><span style="font-family: 宋体">表示平地，</span><span lang="EN-US" style="font-family: 'Times New Roman'">1,2,3</span><span style="font-family: 宋体">表示对应的矿区或者炼矿厂，</span><span lang="EN-US" style="font-family: 'Times New Roman'">4</span><span style="font-family: 宋体">表示山地。（样例</span><span lang="EN-US" style="font-family: 'Times New Roman'">1</span><span style="font-family: 宋体">对应图</span><span lang="EN-US" style="font-family: 'Times New Roman'">2</span><span style="font-family: 宋体">）。可能有多组数据，请处理到文件结尾</span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p></p><hr/><h3>输出格式</h3><p><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">对于每组数据，包含两个整数，表示最小费用和达到最小费用的方案数。如果找不到符合要求的方案，输出</span><span lang="EN-US" style="font-family: 'Times New Roman'">-1 -1</span><span style="font-family: 宋体">。由于方案数可能过大，所以请把方案数</span><span lang="EN-US" style="font-family: 'Times New Roman'">mod 1000000007</span></span></p>
<p></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p></p><hr/><h3>样例输入</h3><pre>【样例输入1】
2
0 1 0 0 0
0 0 2 0 4 0 0
0 0 4 3 0 3 2
0 0 0 1 0

【样例输入2】
3
0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0
0 0 2 0 0 0 0 0 0 0 0
0 0 0 0 0 0 3 0 0 0 0
0 0 0 0 0 0 0 0 0
0 3 0 1 0 2 0
 

</pre><hr/><h3>样例输出</h3><pre>【样例输出1】
18 1
【样例输出2】
44 1
 </pre><hr/><h3>提示</h3><p><p class="MsoNormal" style="margin: 0cm 0cm 0pt">样例2的解释</p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><a href="/JudgeOnline/upload/201105/file/2283_1.jpg"><img height="412" alt="" width="416" src="../file/2283_0.jpg" /></a></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-size: medium"><span style="font-family: 宋体">对于</span><span lang="EN-US" style="font-family: 'Times New Roman'">100%</span><span style="font-family: 宋体">的数据，</span><span lang="EN-US" style="font-family: 'Times New Roman'">N&le;6</span></span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p></p><hr/><h3>题目来源</h3><p>stage 2 day1</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2283" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2283" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>